/**
 * Created by wxb on 2016/10/20.
 */
'use strict';

angular.module('BlurAdmin')
  .factory('teacherUrl', function (publicFunc) {
    var prefix = '/kt/';
    var url = {
      add_updateCurriculum: {
        url: 'admin/msjt/curriculum',
        method: 'POST'
      },
      get_curriculums: {
        url: 'admin/msjt/curriculum',
        method: 'GET'
      },
      get_curriculumsPage: {
        url: 'admin/msjt/teacher/{teacherId}/curriculum/page',
        method: 'GET'
      },
      get_curriculumsPageBasic: {
        url: 'admin/msjt/teacher/{teacherId}/curriculum/page',
        method: 'GET'
      },
      get_curriculum: {
        url: 'admin/msjt/curriculum/{curriculumId}',
        method: 'GET'
      },
      delete_curriculum: {
        url: 'admin/msjt/curriculum/{curriculumId}',
        method: 'DELETE'
      },
      teacher_curriculum: {
        url: 'admin/msjt/teacher/{teacherId}/curriculum',
        method: 'GET'
      },
      curriculum_lessons: {
        url: 'admin/msjt/curriculum/{curriculumId}/lesson',
        method: 'GET'
      },
      curriculum_lessonsAble: {
        url: 'admin/msjt/curriculum/{curriculumId}/lesson/all',
        method: 'GET'
      },
      curriculum_lessonsUnfinished: {
        url: 'admin/msjt/curriculum/{curriculumId}/lesson/unfinished',
        method: 'GET'
      },
      coming_lesson: {
        url: 'admin/msjt/teacher/{teacherId}/lesson/coming',
        method: 'GET'
      },
      week_lessons: {
        url: 'admin/msjt/teacher/{teacherId}/lesson/week/{time}',
        method: 'GET'
      },
      subscription_curriculum: {
        url: 'admin/msjt/curriculum/{curriculumId}/subscription',
        method: 'GET'
      },
      add_updateLesson: {
        url: 'admin/msjt/lesson',
        method: 'POST'
      },
      lesson_videos: {
        url: 'admin/msjt/teacher/{teacherId}/lesson/video',
        method: 'GET'
      },
      delete_lesson: {
        url: 'admin/msjt/lesson/{lessonId}',
        method: 'DELETE'
      },
      stop_curriculum: {
        url: 'admin/msjt/curriculum/{curriculumId}/stopselling',
        method: 'GET'
      },
      resell_curriculum: {
        url: 'admin/msjt/curriculum/{curriculumId}/reselling',
        method: 'GET'
      },
      stop_curriculumWechat: {
        url: 'admin/msjt/curriculum/{curriculumId}/wechat/disable',
        method: 'GET'
      },
      resell_curriculumWechat: {
        url: 'admin/msjt/curriculum/{curriculumId}/wechat/enable',
        method: 'GET'
      },
      curriculum_wechat: {
        url: 'admin/msjt/curriculum/{curriculumId}/display/wechat_only',
        method: 'PUT'
      },
      curriculum_app: {
        url: 'admin/msjt/curriculum/{curriculumId}/display/app_only',
        method: 'PUT'
      },
      curriculum_all: {
        url: 'admin/msjt/curriculum/{curriculumId}/display/all',
        method: 'PUT'
      },
      disable_lesson: {
        url: 'admin/msjt/lesson/{lessonId}/disable',
        method: 'GET'
      },
      enable_lesson: {
        url: 'admin/msjt/lesson/{lessonId}/enable',
        method: 'GET'
      },
      image_token: {
        url: 'admin/config/uploadToken',
        method: 'GET'
      },
      video_token: {
        url: 'admin/config/uploadToken',
        method: 'GET'
      },
      cooperation_token: {
        url: 'admin/cooperation/uploadtoken',
        method: 'GET'
      },
      op_curriculum: {
        url: 'admin/msjt/operator/curriculum',
        method: 'GET'
      },
      op_lesson_video: {
        url: 'admin/msjt/lesson/video',
        method: 'GET'
      },
      theme_curriculums: {
        url: 'admin/msjt/theme/{themeId}/all_curriculum',
        method: 'GET'
      },
      curriculum_property: {
        url: 'admin/msjt/curriculum/{curriculumId}/property',
        method: 'PUT'
      },
      curriculum_diagram: {
        url: 'admin/usage/curriculum/{curriculumId}/diagram',
        method: 'GET'
      },
      lesson_diagram: {
        url: 'admin/usage/lesson/{lessonId}/diagram',
        method: 'GET'
      },
      device_models: {
        url: 'admin/usage/device/models',
        method: 'GET'
      },
      set_lessonProperty: {
        url: 'admin/msjt/lesson/{lessonId}/property',
        method: 'PUT'
      },
      all_channels: {
        url: 'admin/device/channel/all',
        method: 'GET'
      },


    };
    return publicFunc.urlAddPrefix(url, prefix);
  })
  .service('teacherService', function (httpService, teacherUrl) {
    this.addUpdateCurriculum = function (postData) {
      return httpService.http(postData, teacherUrl.add_updateCurriculum, {})
    };
    this.getCurriculums = function () {
      return httpService.http({}, teacherUrl.get_curriculums, {})
    };
    this.getCurriculumsPage = function (queryParams) {
      return httpService.http({}, teacherUrl.get_curriculumsPage, queryParams)
    };
    this.getCurriculumsPageBasic = function (queryParams) {
      return httpService.http({}, teacherUrl.get_curriculumsPageBasic, queryParams)
    };
    this.getCurriculum = function (curriculumId) {
      return httpService.http({}, teacherUrl.get_curriculum, {curriculumId: curriculumId})
    };
    this.deleteCurriculum = function (curriculumId) {
      return httpService.http({}, teacherUrl.delete_curriculum, {curriculumId: curriculumId})
    };
    this.teacherCurriculum = function (teacherId) {
      return httpService.http({}, teacherUrl.teacher_curriculum, {teacherId: teacherId})
    };
    this.curriculumLessons = function (curriculumId) {
      return httpService.http({}, teacherUrl.curriculum_lessons, {curriculumId: curriculumId})
    };
    this.curriculumLessonsAble = function (curriculumId) {
      return httpService.http({}, teacherUrl.curriculum_lessonsAble, {curriculumId: curriculumId})
    };
    this.curriculumLessonsUnfinished = function (curriculumId) {
      return httpService.http({}, teacherUrl.curriculum_lessonsUnfinished, {curriculumId: curriculumId})
    };
    this.comingLesson = function (teacherId) {
      return httpService.http({}, teacherUrl.coming_lesson, {teacherId: teacherId})
    };
    this.weekLessos = function (teacherId, time) {
      return httpService.http({}, teacherUrl.week_lessons, {teacherId: teacherId, time: time})
    };
    this.subscriptionCurriculum = function (queryParams) {
      return httpService.http({}, teacherUrl.subscription_curriculum, queryParams)
    };
    this.addUpdateLesson = function (postData) {
      return httpService.http(postData, teacherUrl.add_updateLesson, {})
    };
    this.lessonVideos = function (queryParams) {
      return httpService.http({}, teacherUrl.lesson_videos, queryParams)
    };
    this.deleteLesson = function (lessonId) {
      return httpService.http({}, teacherUrl.delete_lesson, {lessonId: lessonId})
    };
    this.stopCurriculum = function (curriculumId) {
      return httpService.http({}, teacherUrl.stop_curriculum, {curriculumId: curriculumId})
    };
    this.resellCurriculum = function (curriculumId) {
      return httpService.http({}, teacherUrl.resell_curriculum, {curriculumId: curriculumId})
    };
    this.stopCurriculumWechat = function (curriculumId) {
      return httpService.http({}, teacherUrl.stop_curriculumWechat, {curriculumId: curriculumId})
    };
    this.resellCurriculumWechat = function (curriculumId) {
      return httpService.http({}, teacherUrl.resell_curriculumWechat, {curriculumId: curriculumId})
    };
    this.disableLesson = function (lessonId) {
      return httpService.http({}, teacherUrl.disable_lesson, {lessonId: lessonId})
    };
    this.enableLesson = function (lessonId) {
      return httpService.http({}, teacherUrl.enable_lesson, {lessonId: lessonId})
    };
    this.imageToken = function () {
      return httpService.http({}, teacherUrl.image_token, {})
    };
    this.videoToken = function () {
      return httpService.http({}, teacherUrl.video_token, {})
    };
    this.cooperationToken = function () {
      return httpService.http({}, teacherUrl.cooperation_token, {})
    };
    this.opCurriculum = function (queryParams) {
      return httpService.http({}, teacherUrl.op_curriculum, queryParams)
    };
    this.opLessonVideo = function (queryParams) {
      return httpService.http({}, teacherUrl.op_lesson_video, queryParams)
    };
    this.curriculumWechat = function (curriculumId) {
      return httpService.http({}, teacherUrl.curriculum_wechat, {curriculumId: curriculumId})
    };
    this.curriculumApp = function (curriculumId) {
      return httpService.http({}, teacherUrl.curriculum_app, {curriculumId: curriculumId})
    };
    this.curriculumAll = function (curriculumId) {
      return httpService.http({}, teacherUrl.curriculum_all, {curriculumId: curriculumId})
    };
    this.themeCurriculumAll = function (themeId) {
      return httpService.http({}, teacherUrl.theme_curriculums, {themeId: themeId})
    };
    this.curriculumProperty = function (postData, curriculumId) {
      return httpService.http(postData, teacherUrl.curriculum_property, {curriculumId: curriculumId})
    };
    this.curriculumDiagram = function (queryParams) {
      return httpService.http({}, teacherUrl.curriculum_diagram, queryParams)
    };
    this.lessonDiagram = function (queryParams) {
      return httpService.http({}, teacherUrl.lesson_diagram, queryParams)
    };
    this.deviceModels = function () {
      return httpService.http({}, teacherUrl.device_models, {})
    };
    this.setLessonProperty = function (postData, lessonId) {
      return httpService.http(postData, teacherUrl.set_lessonProperty, {lessonId: lessonId})
    };
    this.allChannels = function () {
      return httpService.http({}, teacherUrl.all_channels, {})
    };


  });
